package com.block.datapush.form.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

@Getter
public enum PushResultEnum {

    /**
     *  * SUCCESS 成功
     *      * FAILED 失败
     *      * WAITCONFIRM 待确认
     *      * TIMEOUT 确认超时
     */
    INIT("INIT","待推送"),
    FILTER_ERROR("FILTER_ERROR","过筛失败"),
    MATCH_ERROR("MATCH_ERROR","撞库失败"),
    SUCCESS("SUCCESS","推送成功"),
    FAILED("FAILED","推送失败"),
    WAIT_CONFIRM("WAIT_CONFIRM","待查询"),//待查询，推送完成之后，为该状态
    TIMEOUT("TIMEOUT","确认超时"),// 如果超时没查询成功的话，则设置为超时状态
    RISK_ERROR("RISK_ERROR","风控未通过"),// 如果超时没查询成功的话，则设置为超时状态
    ;

    private String type;
    private String name;

    PushResultEnum(String type, String name){
        this.type = type;
        this.name = name;
    }

    public static PushResultEnum getEntityByType(String type){
        for (PushResultEnum item: values()){
            if (StrUtil.equals(item.getType(), type)){
                return item;
            }
        }
        return null;
    }
}
